Array.prototype.myMap = function (callback, thisArgs) {
  if (typeof callback !== 'function') {
    new TypeError(`${callback} is not a function`)
  }

  const result = []
  for (let i = 0; i < this.length; i++) {
    result.push(callback.call(thisArgs, this[i], i, this))
  }
  return result
}

console.log([1, 2, 3, 4, 5, 6].myMap((item) => item * 2))
